#include "Game_01.hpp"

coordination end;
void VIEW::updateView(void)
{

	beginPaint();

	setBrushColor(WHITE);
	setPenColor(WHITE);
	rectangle(0, 0, WIDTH, HEIGHT);

	setBrushColor(RED);
	setPenColor(RED);
	for (Bomb& bomb:GAME::bombsInstance.bombs)
	{
		coordination coo = bomb.get_coo();
		ellipse(
			(int)(coo.x - static_cast<double>(Bomb::GUN_SIZE) / 2),
			(int)(coo.y - static_cast<double>(Bomb::GUN_SIZE) / 2),
			(int)(coo.x + static_cast<double>(Bomb::GUN_SIZE) / 2),
			(int)(coo.y + static_cast<double>(Bomb::GUN_SIZE) / 2)
		);
	}

	end.x = (int)(GAME::GUN_LENGTH * cos(M_PI * fortInstance.angle / 180));
	end.y = (int)(GAME::GUN_LENGTH * sin(M_PI * fortInstance.angle / 180));
#ifdef _DEBUG
	//printf("(%d,%d)--updated\n", (int)end.x, (int)end.y);
#endif
	setPenColor(BLACK);
	setPenWidth(Bomb::GUN_SIZE);
	line((int)GAME::base.x, (int)GAME::base.y,
		(int)(GAME::base.x + end.x),
		(int)(GAME::base.y - end.y)
	);

	endPaint();
}